/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
var oTableAsignacion;
var tipo_confirmacion;
var vgl_var;
$(document).ready(function() {
      if( $('input[name="nombre_pagina"]').val() != null    ){
         oTable=$('#tableList').dataTable( {
               "bPaginate": true,
               "bLengthChange": false,
               "bFilter": true,
               "bSort": true,
               "bInfo": true,
               "bAutoWidth": false,
               "bDestroy":true,
               "sPaginationType": "full_numbers",
               //"sScrollY": "351px",
               "sAjaxSource": 'ServletDataTable?strpv_tipoListado=dtpv_asignacionDetalle' ,
                "aoColumns": [
                                { "sTitle": "codigo_asignacion"  ,"bVisible": false },
                                { "sTitle": "codigo_reunion"  ,"bVisible": false },
                                { "sTitle": "Reunion" ,"sClass": "alignLeft"  , "sWidth" : "20%"},
                                { "sTitle": "Acuerdo" ,"sClass": "alignLeft" },
                                { "sTitle": "# Personas" , "sWidth" : "10%"},
                                { "sTitle": "Fecha" , "sWidth" : "10%"}
                            ]
           });
        $('#tableList tbody').delegate("tr", "click", rowClick);
          
    }
    $( "#slider-range-min" ).slider({
        range: "min",
        value: 0,
        min: 0,
        max: 100,
        slide: function( event, ui ) {
            $( "#amount" ).val( ui.value );
        }
    });   
$( "#dialog-detalle-avance" ).dialog({
        title: "Detalle de avances",
        closeOnEscape: false,
        dialogClass: 'no-close',
        autoOpen: false,
        height:240,
        width: 600,
        modal: true,
        buttons: {
            "Aceptar": function() {
                $( this ).dialog( "close" );  
            }
        }
   }).parent('.ui-dialog').find('.ui-dialog-titlebar-close').hide();    

   $('#btnDetalleAvance').click(function(){
        //var codigo = oTable.fnGetData(hlr)[0];
       //CARGARMOS EL DETALLE
       $( "#dialog-detalle-avance" ).dialog("open");
       var sText = '';
       var mapParameter= {};
       mapParameter['metodo'] = 'obtenerListadoParticipantesAsignados';
       mapParameter['strpv_codigoAsignacion'] = oTable.fnGetData(hlr)[0];
       $.ajax({
            type: "POST",
            url: 'ServletMantenimiento',
            data: mapParameter,            
            async : true,
            dataType: "json",
            success: function( lst ){
                sText += '<table>'
                $.each(lst, function(index, obj) {
                    sText += '<tr>'
                    sText += '<td style="width:352px"> <img src="img/icon/arrow-green.png" style="padding-right:5px;" />'+obj.strpv_nombreEmpleado+'</td>'
                    sText += '<td>'+obj.strpv_porcentaje+' %</td>'
                    sText += '</tr>'
                });
                sText += '</table>'
                $('#div-content-avance').html(sText);
            }
        });
   });
   
  
});
